/*
 * @Author: 黎明 3111345436@qq.com
 * @Date: 2023-01-10 23:26:29
 * @LastEditors: Andy
 * @LastEditTime: 2023-01-18 14:12:10
 * @FilePath: \cain-ui\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vuejsx from "@vitejs/plugin-vue-jsx";
import * as path from "path";
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), vuejsx({})],
  build: {
    lib: {
      entry: path.resolve(__dirname, "./script/script.ts"),
      name: "cain-ui",
      fileName: (format) => `cain-ui.${format}.js`,
    },
    rollupOptions: {
      external: ["vue"],
      output: {
        globals: {
          vue: "Vue",
        },
      },
      plugins: [],
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@import './styles/globalScss.module.scss';
                         `,
      },
    },
  },
});
